Historical oEu intro, Revision 1

Introducing Euphoria

A suggested replacement for the first page of the Euphoria documentation.

Comments?

The forum topic is for discussing this Euphoria introduction.

http://openeuphoria.org/forum/121820.wc?last_id=121866

ToDo List

  • hyperlinks, connect all statements to a reference that justifies any claims (speed, easy, power, ...)
  • hyperlinks for gui libraries, and other resources
  • png screen grabs
  • copy png images to Euphoria wiki?
  • indentation within <eucode> when placed within a table
  • add benchmark programs to Euphoria distribution in the "demo" section
  • pre-processor
  • A few examples needed to showcase Euphoria
  • I am not sure how this is laid out on the page, but i suggest two columns here, your multiply in one and a foreach in the other, then below those with your "while" in one, and an equally good "case" demo in the other. I'd then mention the interesting way you can jump into a while loop to emulate "repeat-until" loops, and the controlled "goto" to get you out of loops of any depth or complexity. Some mention should be made of tasks.e multitasking.
  • remove words to make reading easier!
Anyone can add items to this ToDo list.
Sign-in and edit the wiki.

My Replies

  • Thanks for the help I am getting.
  • "Accomodate your needs"
    your needs are "fast | flexible | friendly"
    ok, some artistic leeway for an enthusiastic introduction?
  • mouseover
    I don't think that is a feature of the wiki.

Objective: An enthusiastic introduction to OpenEuphoria. Provide verifiable support for the enthusiasm. Provide links for all major ideas presented.

OpenEuphoria

OpenEuphoria* is...fast | flexible | friendly...the programming language with great features.

http://openeuphoria.org/logos//80x84-mongoose-color-lite.png The mongoose is our adopted animal friend. Rudyard Kipling, in the Jungle Book*, describes the "–snake’s blow against mongoose’s jump–". A mongoose is curious and friendly but no poisonous snake will win a battle between the two.

Accelerate your programming.
Euphoria programs just run faster*. The eui interpreter--likely the fastest you will encounter--provides rapid program development. Then if you want to, euc compiles your programs into self-contained executables that are faster again. Euphoria speed does not compromise subscript checking, uninitialized variable checking, garbage collection, and numerous other run-time checks.
Accommodate your needs.
Euphoria gives you flexibility and power.
Euphoria is a general purpose, versatile, multi-gui, multi-platform, and portable. Write at a high level and yet interface to C, DLL's and SO's. Unique simplified data handling requires only atoms/sequences. The standard library provides plenty of utility.

web.png The OpenEuphoria website is powered by Euphoria.
win.png Native Windows GUI and IDE.
tinewg.png Simple Windows GUI and IDE.
wx.png WxWidegets for multi-platform programming.
gtk.png Native GTK GUI for Linux.

Accomplish more.
Euphoria is small and friendly: easy to read, easy to learn, and easy to use. Atoms/sequences are higher level and easier to use than conventional data-types. Write code the way you want with simple English words and freeform layout. Euphoria is responsive and gives useful error messages when you need them. Euphoria is supported with GUI libraries, tracing, testing, documentation tools, editing choices, sample programs, and a helpful forum. Euphoria is free, open source, and actively being developed.

.. .. ..
Euphoria is powerful

Apply operators and functions
to every element of a sequence
at once.

-- power
sequence nums = { 5, 6, 7 }
? nums * 2
-- Output: { 10, 12, 14 }
? nums * { 2, 3, 4 }
-- Output: { 10, 18, 28 } 
Euphoria is flexible

Make loops and conditionals
do exactly what you want
them do to.

-- flexibility
while 1 label "families" do
while 1 do -- labels are optional
while 1 label "children" do
exit "families" -- exit top level while
end while
end while
end while 
Euphoria is innovative

Write numbers using
convenient notation

-- inovation
integer easy = 1_923_993, hard = 1923993
printf(1, "%d = %d\n", { easy, hard })
-- Output: 1923993 = 1923993
.. .. ..

A one-of-a-kind language.
Euphoria has a unique* data-type design. Three easy to learn built-in data-types achieve what in a conventional language requires many, harder to learn, concepts. Imagine our mongoose having a meal. An atom is just a bite: a single number, integer, or character. A sequence is the complete meal or entire the entire buffet: mixed values, list, array, tree, string, nested, or flat. An object is universal and dynamic; you can taste just one bite, have the buffet, or anything in-between.

Yes, it is true.
Euphoria users are understandably enthusiastic. With little effort you can confirm, for yourself, that Euphoria is an exceptional programming language. To learn more about Euphoria just try it out--download* one 12MB file, install quickly on Windows, Unix (Linux, BSD, ...), or OS X, and get a ready to use programming environment with documentation and sample programs.
* Power Explained: object, atom and sequence.

* Speed Benchmarked: Euphoria is faster than Python, Perl, ...

* Examples Illustrate: flexibility of Euphoria.

* Easy Defined: a language that is simple, small, consistent, and predictable.

Power Explained: object, atom and sequence.

"essay in progress"
An atom is any single datum (number, integer, character, boolean). In a conventional language that would be four separate data-types, but one is enough and much simpler.

In Euphoria you always introduce a variable before you can use it. This looks like:

atom x = 3.14159 
atom test = 1 
atom letter = 'a' 

Then, you can use the variable in your programming. Any line starting with a double dash ( - -) is a comment; comments are for documentation only and are ignored when programs run. To display an atom--as a number--you print . To display an atom--as a character--you puts . The atom data-type itself always remains the same; you simply choose how an atom will be displayed; no data-type conversions are needed for this to happen.

print(1, x + test ) 
	-- 4.14159 
puts(1, letter) 
	-- a 

Requiring an introduction for each variable ensures that the data-type is explicit and a value has been assigned. Spontaneous creation of variables (typical in some conventional interpreted languages) is fun as you type new code but can result in subtle bugs and becomes hard to read latter on.

Euphoria now dynamically takes care of messy details for you. Euphoria uses less memory for small integers, provides extra memory for large real numbers, promotes oversize integers into exponential form, seamlessly allows mixed calculations between integers and floats, recognizes 0 as false and others as true, and stores characters as simple integer values.

A sequence is any collective data (atom, sequence, object, nested sequence, string, list, array, stack, tree, ... ). This is were Euphoria becomes truly remarkable. A conventional language will have many data-types, each with specialized rules, dedicated to arranging and manipulating data--Euphoria only needs one.

sequence word_example = "hello" 
sequence list_example = { 1, 2, 3 } 
sequence mixed_example = { "red", 10e3, { 2, 4, 6}, { 1 { 2 { 3 }} } 
sequence empty_example = {} 

After introducing a variable as a sequence data-type Euphoria lets you dynamically do anything. You are only limited by your imagination and the memory available on your computer. For example any variable could be the contents of a book, completely empty, or the contents of a spreadsheet; at one moment it could be full of string data and in the next line it could be full of numbers. All classical computer science arrangements--lists, queues, arrays, structures, trees, ..., and more--can be represented by the sequence type.

Euphoria data-types hide a lot of messy details. If you are new to programming this reduces what you have to learn and use. If you are an expert then you will appreciate how Euphoria lets you rapidly develop programs.

Speed Benchmarked: Euphoria is Faster than Python, Perl, ...

"essay in progress"
Benchmarking the speed of computer languages has been described as only a game: benchmarksgame.alioth.debian.org .

To appreciate how fast Euphoria can be try some benchmark* programs.

Proper benchmarking of computer languages to determine which is fastest is hard work. But, Euphoria is convincingly faster so rigorous testing is not needed.

Euphoria finishes; Python crashes. In the binary-tree benchmark keep increasing the size of the argument. On my computer Python crashes at 24 while Euphoria gives you the answer.

Examples Illustrate: The Flexibility of Euphoria.

"essay in progress"
Consider* adding values of corresponding elements from two lists; using Euphoria only one statement is needed:

? list1 + list2 

For example:

sequence list1 = { 1, 2, 3 }, list2 = { 10, 20, 30 } 
? list1 + list1 
--> { 11, 22, 33 } 

Python* requires more work. Notice the syntax based on invisible punctuation (don't confuse a space with a tab); consistency is broken by the need for extra punctuation.

# Python version. 
def pairwise_sum(list1, list2): 
	result = [] 
	for i in range(len(list1)): 
		result.append(list1[i] + list2[i]) 
	return result 

Perl* tends to be difficult to read.

# Perl version. 
sub pairwise_sum { 
	my($arg1, $arg2) = @_; 
	my(@result) = (); 
	@list1 = @$arg1; 
	@list2 = @$arg2; 
	for($i=0; $i < length(@list1); $i++) { 
		push(@result, $list1[$i] + $list2[$i]); 
	} 
	return(\@result); 
} 

The Euphoria function is short and easy to read.

function pairwise_sum( sequence list1, sequence list2 ) 
	return list1 + list2 
end function 

A Euphoria GUI program to minimally display a window:

#!/usr/bin/eui 
                    -- example: base.ex 
include GtkEngine.e 
                    -- Set up the window and the button within. 
constant window = create(GtkWindow) 
constant button = create(GtkButton, "Hello World" ) 
add(window,button) 
                    -- Show the GUI 
show_all(window) 
main() 

In Python the same program looks like:

#!/usr/bin/env python 
 
# example base.py 
import pygtk 
pygtk.require(’2.0’) 
import gtk 
 
class Base: 
    def __init__(self): 
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) 
        self.window.show() 
 
    def main(self): 
        gtk.main() 
 
print __name__ 
if __name__ == "__main__": 
    base = Base() 
    base.main()  

base.png Minimal GUI window.

Easy Defined: a Language that is Simple, Small, Consistent, and Predictable.

"essay in progress"

imperative, natural for most programmers, results in fast efficient execution

small (less to learn and remember)

easy to read (English keywords, begin something end something, freeform, no exceptions, pseudocode, visible syntax )

introduce variables and routines

consistent

predictable

speed, clean, powerful


References

  1. www.OpenEuphoria.org
  2. Rudyard Kipling The Jungle Book. Rikki-Tikki-Tavi is a mongoose in a classic story by Rudyard Kipling. http://www.gutenberg.org/files/236/236-h/236-h.htm
  3. Rikki-tikki-tavi, http://www.cs.cmu.edu/mongoose/rtt.html
  4. Run your own benchmarks to confirm Euphoria is fast. Sample benchmark programs are included with Euphoria. More information on benchmarking: http://benchmarksgame.alioth.debian.org/
  5. Euphoria as invented by Robert Craig. He released Euphoria V1.0 in July 1993 as shareware by Rapid Deployment Software (RDS). We are now an open source project working at version V4 with many people contributing to its development.
  6. Examples to show Python is simpler than Perl: The Quick Python Book, Second Edition Revised edition of The Quick Python Book by Daryl K. Harms and Kenneth M. McDonald. Naomi R. Ceder January, 2010 ISBN: 9781935182207
  7. PyGTK 2.0 Tutorial by John Finlay Published April 13, 2005 This tutorial describes the use of the Python PyGTK module.

OpenEuphoria

Additional Resources

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu